﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
                    xmlns:controls="clr-namespace:Brjnk.GpxExplorer.UI.Controls;assembly=GpxExplorer"
                    xmlns:data="clr-namespace:Brjnk.GpxExplorer.Data;assembly=GpxExplorer"
                    xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization;assembly=GpxExplorer"
                    xmlns:layers="clr-namespace:Brjnk.CoordinateSystem2D.Layers;assembly=CoordinateSystem2D"
                    xmlns:loc="clr-namespace:Brjnk.GpxExplorer.Localization;assembly=GpxExplorer"
                    xmlns:local="clr-namespace:Brjnk.GpxExplorer;assembly=GpxExplorer"
                    xmlns:ui="clr-namespace:Brjnk.Common.UI;assembly=Common"
                    xmlns:vm="clr-namespace:Brjnk.GpxExplorer.ViewModel;assembly=GpxExplorer"
                    xmlns:workspace="clr-namespace:Brjnk.GpxExplorer.Workspace;assembly=GpxExplorer"
                    xmlns:searching="clr-namespace:Brjnk.GpxExplorer.Workspace.Searching">
    <SolidColorBrush x:Key="ItemBorderBrush" Color="Black" />

    <DataTemplate x:Key="AreaPopupWaypointTemplate">
        <Border BorderThickness="0 1 0 0" BorderBrush="{StaticResource ItemBorderBrush}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Image Width="16" Height="16" Source="/Resources/Icons/Waypoint.png" />
                <StackPanel Grid.Column="1">
                    <StackPanel.Resources>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <Trigger Property="Text" Value="">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                                <Trigger Property="Text" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Resources>
                    <TextBlock FontWeight="Bold" Text="{Binding Source.Name}" />
                    <TextBlock Text="{Binding Source.Comment}" />
                    <TextBlock Text="{Binding Source.Description}" />
                    <TextBlock Text="{Binding Source.Elevation, Converter={StaticResource ElevationConverter}}" />
                    <TextBlock Text="{Binding Source.Time, Converter={StaticResource NullableConverter}}" />
                    <TextBlock Text="{Binding Source.Geocache.Name}" />
                    <TextBlock Text="{Binding Source.Geocache.Type}" />
                    <TextBlock Text="{Binding Source.Geocache.Terrain}" />
                    <TextBlock Text="{Binding Source.Geocache.Difficulty}" />
                    <TextBlock Text="{Binding Source.Geocache.Size}" />
                </StackPanel>
            </Grid>
        </Border>
    </DataTemplate>

    <DataTemplate x:Key="AreaPopupWaypointResultTemplate">
        <ContentControl Content="{Binding SearchedItem}" ContentTemplate="{StaticResource AreaPopupWaypointTemplate}" />
    </DataTemplate>

    <DataTemplate x:Key="AreaPopupSearchRequestTemplate">
        <StackPanel>
            <StackPanel.Resources>
                <Style TargetType="TextBlock">
                    <Style.Triggers>
                        <Trigger Property="Text" Value="">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Text" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Resources>
            <TextBlock FontWeight="Bold" Text="{Binding StringRepresentation}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="AreaPopupSearchResultTemplate">
        <StackPanel>
            <ContentControl Content="{Binding SearchedItem}" ContentTemplate="{StaticResource AreaPopupSearchRequestTemplate}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="AreaPopupTrackTemplate">
        <Border BorderThickness="0 1 0 0"  BorderBrush="{StaticResource ItemBorderBrush}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Image Width="16" Height="16" Source="/Resources/Icons/Track.png" />
                <StackPanel Grid.Column="1">
                    <StackPanel.Resources>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <Trigger Property="Text" Value="">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                                <Trigger Property="Text" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Resources>
                    <TextBlock FontWeight="Bold" Text="{Binding Source.Name}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Number, RelativeSource={RelativeSource Mode=Self}}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Distance, RelativeSource={RelativeSource Mode=Self}}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Elevation, Converter={StaticResource TrackPointElevationConverter}, RelativeSource={RelativeSource Mode=Self}}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Time, Converter={StaticResource TrackPointAttributeValueConverter}, RelativeSource={RelativeSource Mode=Self}}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Duration, Converter={StaticResource TrackPointAttributeValueConverter}, RelativeSource={RelativeSource Mode=Self}}" />
                </StackPanel>
            </Grid>
        </Border>
    </DataTemplate>

    <DataTemplate x:Key="AreaPopupRouteTemplate">
        <Border BorderThickness="0 1 0 0"  BorderBrush="{StaticResource ItemBorderBrush}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Image Width="16" Height="16" Source="/Resources/Icons/Route.png" />
                <StackPanel Grid.Column="1">
                    <StackPanel.Resources>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <Trigger Property="Text" Value="">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                                <Trigger Property="Text" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Resources>
                    <TextBlock FontWeight="Bold" Text="{Binding Source.Name}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Num, RelativeSource={RelativeSource Mode=Self}}" />
                    <TextBlock Text="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject.Distance, RelativeSource={RelativeSource Mode=Self}}" />
                </StackPanel>
            </Grid>
        </Border>
    </DataTemplate>
</ResourceDictionary>